#pragma once

#include <string>
#include <iostream>
#include <openssl/evp.h>
#include <jwt.h>

#include "NoCopy.h"
#include "User.h"

class CryptoUtil
: public NoCopy
{
public:
    static std::string generate_salt(int length = 20);
    static std::string hash(User &user, const EVP_MD *evp_md = EVP_sha256());
    static std::string hashFile(std::string content, const EVP_MD *evp_md = EVP_sha256());
    static std::string generate_token(const User &user, jwt_alg_t jwt_alg = JWT_ALG_HS256);
    static bool varify_token(std::string &token, User &user);

};